#include "Teacher.h"
#include <string>
#include <iostream>
using namespace std;

Teacher::Teacher(string id, string name, size_t age, Klass *klass) : Person(id, name, age), klass(klass) {
}

string Teacher::Introduce()
{
    string result;
    result += Person::Introduce() + " I am a Teacher. I am teaching ";
    if(this->klass == nullptr) {
        result += "No Class.";
    } else {
        result += "Class " + *(this->klass) + ".";
    }
    return result;
}

string Teacher::IntroduceWith(Student &student){
    string result = this->BuildIntroduceBaseString(); 
    string teachingString = " I";
    if(this->klass != nullptr && student.IsIn(*this->klass)){
        teachingString += " teach ";
    }else {
        teachingString += " don't teach ";
        
    }

    result += student.WithName([teachingString](string name) { 
        return teachingString + name + "."; 
    });


    return result;
}

string Teacher::BuildIntroduceBaseString(){
    return Person::Introduce() + " I am a Teacher.";
}